package com.library.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 图书借阅状态
 *
 * @author: xyh
 * @create: 2023-08-14
 **/
@Getter
@AllArgsConstructor
public enum BookBorrowingEnum {

    BORROWING(0, "借阅中"),
    RETURN(1, "已归还"),
    OVERDUE(2, "已逾期"),
    RETURN_AUDIT(3, "还书审核中"),
    RETURN_FAIL(4, "还书不通过");

    private Integer code;
    private String desc;


    public static String getValue(Integer code) {
        BookBorrowingEnum[] borrowingEnums = values();
        for (BookBorrowingEnum borrowingEnum : borrowingEnums) {
            if (borrowingEnum.getCode().equals(code)) {
                return borrowingEnum.getDesc();
            }
        }
        return null;
    }
}
